const path = require('path')
const uglufy = require('uglifyjs-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const rootPath = process.cwd()
module.exports = {
  entry: rootPath + "/src/main.js",
  output: {
    filename: "bundle.js",
    publicPath: '/'
  },
  resolve: {},
  module: {
    loaders: [
      {
        test: /\.less$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
              options: {
                minimize: true
              }
            },
            // {
            //   loader: 'postcss-loader',
            //   options: {
            //     config: {
            //       path: rootPath + '/postcss.config.js'
            //     }
            //   }
            // },
            {
              loader: 'less-loader'
            }
          ]
        })
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modles/,
        query: {
          presets: ['es2015', 'stage-0', 'react'],
          compact: false
        }
      }
    ]
  },
  plugins: [
    new ExtractTextPlugin('css/main.css')
  ],
}

